﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using DroidClaimBL.Dto;
using log4net;

namespace DroidClaimBL
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "DroidClaimBL" in code, svc and config file together.
    // NOTE: In order to launch WCF Test Client for testing this service, please select DroidClaimBL.svc or DroidClaimBL.svc.cs at the Solution Explorer and start debugging.
    public class DroidClaimBL : IDroidClaimBL
    {
        ILog logger;
        public DroidClaimBL()
        {

        }
        /*
            public class AuthenCustomerDto
            {
                public string LicensePlate { get; set; }
                public string Password { get; set; }
            }
            
            public class AuthenCustomerResultDto
            {
                public bool Result { get; set; }
                public string ErrorMsg { get; set; }
                public string SessionId { get; set; }
                public CustomerDto customerInfo { get; set; }
            }
         
         */
        public AuthenCustomerResultDto AuthenCustomer(AuthenCustomerDto AuthenCustomer)
        {
            // Find Customer Object
            // if found delete current session and create new session then send it bace to caller
            return new AuthenCustomerResultDto
            {
                customerInfo = new CustomerDto
                {
                    CarBrand = "CarBrand",
                    CarColor = "CarColor",
                    CarImg = "CarImg",
                    CarModel = "CarModel",
                    CustImg = "CustImg",
                    InsurancePackage = "Package",
                    LicensePlate = "LicensePlate",
                    Mobile = "Mobile",
                    Name = "Name",
                    Surname = "Surname"
                },
                ErrorMsg = "",
                Result = true,
                SessionId = "qwkoekekeorkweor"
            };
        }

        /*
            public class ClaimRequestDto
            {
                public string SessionId { get; set; }
                public string AccImg { get; set; }
                public double Latitude { get; set; }
                public double Longitude { get; set; }
                public string Location { get; set; }
            }

            public class ClaimRequestResultDto
            {
                public bool Result { get; set; }
                public string ErrorMsg { get; set; }
                public int ClaimInfoId { get; set; }
            }
        */
        public ClaimRequestResultDto AddClaimRequest(ClaimRequestDto CliamRequest)
        {
            // keep Claim Info ลง Database
            // return true if success
            return new ClaimRequestResultDto
            {
                ClaimInfoId = 1,
                ErrorMsg = "",
                Result = true
            };
        }

        /*
            public class SessionPkDto
            {
                public string LicensePlate { get; set; }
            }

            public class ClaimInfoDto
            {
                public int Id { get; set; }
                public DateTime AccDate { get; set; }
                public string AccidentLocation { get; set; }
                public double Latitude { get; set; }
                public double Longitude { get; set; }
                public DateTime UpdateDate { get; set; }
                public int Status { get; set; }
                public string LicensePlateNo { get; set; }
                public string SurvName { get; set; }
                public string SurvMobile { get; set; }
                public string SurvImg { get; set; }
            }
        */

        public List<ClaimInfoDto> GetAllClaimInfoForCustomer(SessionPkDto SessionPk)
        {
            // get list of Claiminfo of customer

            return new List<ClaimInfoDto>
            {
                new ClaimInfoDto{ 
                    AccDate=DateTime.Now,
                    AccidentLocation="AccidentLocation",
                    Id=1,
                    Latitude=13.021233,
                    LicensePlateNo="LicensePlateNo",
                    Longitude=123.023123,
                    Status=1,
                    SurvImg="SurvImg",
                    SurvMobile="SurvMobile",
                    SurvName="SurvName",
                    UpdateDate=DateTime.Now
                },
                new ClaimInfoDto{ 
                    AccDate=DateTime.Now,
                    AccidentLocation="AccidentLocation2",
                    Id=1,
                    Latitude=13.021233,
                    LicensePlateNo="LicensePlateNo2",
                    Longitude=123.023123,
                    Status=1,
                    SurvImg="SurvImg2",
                    SurvMobile="SurvMobile2",
                    SurvName="SurvName2",
                    UpdateDate=DateTime.Now
                }
            };
        }
        
        /*
            public class SessionPkDto
            {
                public string LicensePlate { get; set; }
            }
        */

        public bool Logout(SessionPkDto SessionPk)
        {
            // delete session

            logger = LogManager.GetLogger("/Logout");
            logger.Debug("Input parameters LicensePlate : " +SessionPk.LicensePlate);
            if (SessionPk.LicensePlate == "123")
                return true;
            else
                return false;
        }

        // for test
        public CustomerDto GetCustomer()
        {
            logger = LogManager.GetLogger("/GetCustomer");
            logger.Info("GetCustomer ");
            return new CustomerDto
            {
                CarBrand = "CarBrand",
                CarColor = "CarColor",
                CarImg = "CarImg",
                CarModel = "CarModel",
                CustImg = "CustImg",
                InsurancePackage = "Package",
                LicensePlate = "LicensePlate",
                Mobile = "Mobile",
                Name = "Name",
                Surname = "Surname"
            };
        }


        //
        // Surveryor
        //
        /*
        public class AuthenSurveyorDto
        {
            public string Username { get; set; }
            public string Password { get; set; }
            public bool noSurveyorData { get; set; }
        }

        public class AuthenSurveyorResultDto
        {
            public bool Result { get; set; }
            public string ErrorMsg { get; set; }
            public string SessionId { get; set; }
            public SurveyorDto surveyorInfo { get; set; }
        }
        */
        public AuthenSurveyorResultDto AuthenSurveyor(AuthenSurveyorDto AuthenSurveyor)
        {
            return null;
        }

        /*
        public class SurveyorStatusDto
        {
            public string SessionId { get; set; }
            public bool Status { get; set; }
            public double Latitude { get; set; }
            public double Longitude { get; set; }
        }

        public class UpdateSurveyorStatusResultDto
        {
            public bool Result { get; set; }
            public string ErrorMsg { get; set; }
        }
        */
        public UpdateSurveyorStatusResultDto UpdateSurveyorStatus(SurveyorStatusDto Status)
        {
            return null;
        }

        /*
        public class SurveyorLocationDto
        {
            public string SessionId { get; set; }
            public bool Status { get; set; }
            public double Latitude { get; set; }
            public double Longitude { get; set; }
        }

        public class UpdateSurveyorLocationResultDto
        {
            public bool Result { get; set; }
            public string ErrorMsg { get; set; }
        }
        */
        public UpdateSurveyorLocationResultDto UpdateSurveyorLocation(SurveyorLocationDto Status)
        {
            return null;
        }

        public SurveyorLocationResultDto GetSurveyorLocation(ClaimInfoPKDto CliamInfoPk)
        {
            return null;
        }

        /*
        public class ClaimInfoPKDto
        {
            string SessionId { get; set; }
            int Id { get; set; }
        }
        public class ClaimInfoForSurveyorResultDto
        {
            public string LicensePlate { get; set; }
            public string CustName { get; set; }
            public string CarDetail { get; set; }
            public string CustMobile { get; set; }
            public string CarImage { get; set; }
            public DateTime AccidentDate { get; set; }
            public string AccidentLocation { get; set; }
            public double AccidentLatitude { get; set; }
            public double AccidentLongitude { get; set; }
            }
         */
        public ClaimInfoForSurveyorResultDto GetClaimInfoForSurveyor(ClaimInfoPKDto CliamInfoPk)
        {
            return null;
        }
        /*
        public class DenyMessageDto
        {
            public String SessionId { get; set; }
            public String ClaimId { get; set; }
            public String DenyReason { get; set; }
        }
        public class DenyMessageResultDto
        {
            public bool Result { get; set; }
            public string ErrorMsg { get; set; }
        }
        */
        public DenyMessageResultDto SendDenyMessage(DenyMessageDto DenyMessage)
        {
            return null;
        }
        /*
        public class UpdateClaimInfoDto
        {
            public string SessionId { get; set; }
            public int ClaimId { get; set; }
            public string ClaimDocImage { get; set; }
        }
        public class ClaimIdResultDto
        {
            public string ClaimNumber { get; set; }
            public string ErrorMsg { get; set; }
        }*/
        public ClaimIdResultDto UpdateClaim(UpdateClaimInfoDto UpdateClaimInfo)
        {
            return null;
        }
    }
}
